package com.anzia.streamreader;

import java.io.FileInputStream;
import java.io.InputStreamReader;

/**
 *@ClassName InputStreamReader_Demo
 *@Description
 *@Author Anzia.
 *@Date 2021/4/9 17:45
 *@Version 1.0
 **/
public class InputStreamReader_Demo {
    public static void main(String[] args) throws Exception {
        //创建对象
        FileInputStream fis = new FileInputStream("static\\write.txt");
        InputStreamReader isr = new InputStreamReader(fis,"utf-8");

        //读取文件
        int data = 0;
        while ((data = isr.read()) != -1) {
            System.out.print((char) data);
        }

        //关闭
        isr.close();
        System.out.println();
        System.out.println("执行成功！");
    }
}
